<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <script src="http://cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/jquery-mobile/1.4.5/jquery.mobile.min.js"></script>
    <script src="http://cdn.bootcss.com/Director/1.2.8/director.min.js"></script>
    <script>
        var router = new Router({})
                .configure({
                    notfound: function () {
                        alert(location.href + '|' + history.length);
                    }
                }).
                init();
    </script>
    <style>
        a {
            background-color: gold;
            margin: 20px;
            padding: 10px;
            display: inline-block;
        }

        div {
            background-color: red;
            color: white;
            text-align: center;
            padding: 20px;
        }

        #blue {
            display: none;
            background-color: blue;
            padding: 30px;
        }
    </style>
</head>
<body>
<a href="#1">1</a>
<a href="#2">2</a>
<a href="#3">3</a>
<a href="#4">4</a>
<a onclick="history.back()">back</a>

<div id="blue"></div>
<div id="show"></div>

<script>

    //    var str = 'axxbxxcxx'.replace(/.(x)(x)/g, function (a, b, c,d) {
    //        console.log(a, b, c,d);
    //    });

    //    var ttt = 0;


    //    var times = 0;
    //
    //    var show = document.getElementById('show');
    $('#show').on('tap',function(){
        console.log('tap');
    })

    $(document).ready(function () {


        setTimeout(function () {
            location.hash = '1';
            setTimeout(function () {
                location.hash = '2';
                setTimeout(function () {
                    document.cookie = 'a=' + Math.random() + '';
                    alert('back');
                    history.back();
                    setTimeout(function () {
                        location.hash = '3';
                        setTimeout(function () {
                            location.hash = '4';
                        }, 1);
                    }, 2);
                }, 3);
            }, 4);
        }, 5);

    });

    setInterval(function () {
        show.innerHTML = location.href + '<br>' + history.length;
    }, 10);


</script>

</body>
</html>